import type {
  GetPatientInfoRes,
  GetPatientItemRes,
  GetUserInfoRes,
  PostPatientAddParams,
  PostPatientAddRes,
  PutPatientUpdateParams,
  PutPatientUpdateRes,
} from '@/types/user'
import { request } from '@/utils/request'
import type { HttpRequestConfig } from 'luch-request'

/**
 * 获取个人用户信息
 */
export const getUserInfoAPI = () => request<GetUserInfoRes>('/patient/myUser')

/**
 * 问诊-添加患者信息
 */
export const postPatientAddAPI = (data: PostPatientAddParams) =>
  request<PostPatientAddRes>('/patient/add', 'POST', data)

/**
 * 问诊-查询患者列表信息
 */
export const getPatientMyListAPI = () => request<GetPatientItemRes[]>('/patient/myList')

/**
 * 问诊-删除患者
 */
export const deletePatientAPI = (id: string) => request(`/patient/del/${id}`, 'DELETE')

/**
 * 问诊-查询患者详情  直接用列表的信息就行
 */
export const getPatientInfoAPI = (id: string) => request<GetPatientInfoRes>(`/patient/info/${id}`)

/**
 * 问诊-编辑患者信息
 */
export const putPatientUpdateAPI = (data: PutPatientUpdateParams) =>
  request<PutPatientUpdateRes>('/patient/update', 'PUT', data)
